package com.education.wisdom.service.impl;

import com.education.common.utils.Convert;
import com.education.wisdom.mapper.HelpResourcesMapper;
import com.education.wisdom.pojo.HelpResources;
import com.education.wisdom.service.IHelpResourcesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 解决求助资源 服务层实现
 *
 * @author ruoyi
 * @date 2019-02-19
 */
@Service
public class HelpResourcesServiceImpl implements IHelpResourcesService {
    @Autowired
    private HelpResourcesMapper helpResourcesMapper;

    /**
     * 查询解决求助资源信息
     *
     * @param id 解决求助资源ID
     * @return 解决求助资源信息
     */
    @Override
    public HelpResources selectHelpResourcesById(Integer id) {
        return helpResourcesMapper.selectHelpResourcesById(id);
    }

    /**
     * 查询解决求助资源列表
     *
     * @param helpResources 解决求助资源信息
     * @return 解决求助资源集合
     */
    @Override
    public List<HelpResources> selectHelpResourcesList(HelpResources helpResources) {
        return helpResourcesMapper.selectHelpResourcesList(helpResources);
    }

    /**
     * 新增解决求助资源
     *
     * @param helpResources 解决求助资源信息
     * @return 结果
     */
    @Override
    public int insertHelpResources(HelpResources helpResources) {
        return helpResourcesMapper.insertHelpResources(helpResources);
    }

    /**
     * 修改解决求助资源
     *
     * @param helpResources 解决求助资源信息
     * @return 结果
     */
    @Override
    public int updateHelpResources(HelpResources helpResources) {
        return helpResourcesMapper.updateHelpResources(helpResources);
    }

    /**
     * 删除解决求助资源对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteHelpResourcesByIds(String ids) {
        return helpResourcesMapper.deleteHelpResourcesByIds(Convert.toStrArray(ids));
    }

    @Override
    public List<HelpResources> selectHelpResourcesByHelpId(Integer id) {
        return helpResourcesMapper.selectHelpResourcesByHelpId(id);
    }

    @Override
    public Integer selectByHelpIdAndIsAdopt(Integer helpId) {
        return helpResourcesMapper.selectByHelpIdAndIsAdopt(helpId);
    }

}
